﻿@model IEnumerable<Traxz.Models.ExerciseSession>

@{
    ViewBag.Title = "Your Exercise Sessions";
    int Page = ViewBag.pageNum;
}
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true"></script>
<script type="text/javascript">

    function initialize() {

        var firstlat;

        var firstlon;

        var points = [];
        @{int counter=0;}
   @foreach (var item in @ViewBag.LatLons)
   {
    counter++;
     <text>
     points.push(new google.maps.LatLng(parseFloat(@Html.Raw(item.Latitude + "")),parseFloat(@Html.Raw(item.Longitude + ""))));
     </text>
      if(counter == 1)
      {
      <text>
      firstlat = (parseFloat(@Html.Raw(item.Latitude + "")));
      firstlon = (parseFloat(@Html.Raw(item.Longitude + "")));
      </text>
      }
   }
        var myLatLng = new google.maps.LatLng(firstlat, firstlon);


        var myOptions = {

            zoom: 3,

            center: myLatLng,

            mapTypeId: google.maps.MapTypeId.TERRAIN

        };



        var map = new google.maps.Map(document.getElementById("map_canvas"),

      myOptions);



        var flightPath = new google.maps.Polyline({

            path: points,

            strokeColor: "#FF0000",

            strokeOpacity: 1.0,

            strokeWeight: 2

        });



        flightPath.setMap(map);

    }

    </script>
    

<div id="myCont">
<div id="right" >
<div id="right-top">
<div id="surrESD">
<h5 style="text-align: center; vertical-align: middle; ">Exercise Session Data</h5>
</div>
<img alt="" src="../../Content/img/qbic.png" width="20" height="20" /> : Calories: @ViewBag.CurrSess.CaloriesBurned <br />
<hr />
<img alt="" src="../../Content/img/qbic.png" width="20" height="20" /> : Distance: @ViewBag.CurrSess.Distance<br />
<hr />
<img alt="" src="../../Content/img/qbic.png" width="20" height="20" /> : Average Speed: @ViewBag.CurrSess.AvgSpeed<br />
<hr />
<img alt="" src="../../Content/img/qbic.png" width="20" height="20" /> : Time: @ViewBag.CurrSess.TotalTime<br />
<hr />
</div>
<div id="map_canvas" style="width: 90%; height: 90%; border:solid; border-bottom-width:2px; margin-top: 10px " >
</div>
</div>
<div id="left" >
<img src="../../Content/img/ExerciseSessionButtonNew.png" width = "200" height="60" />
<div id="inner-left">
    @{int count = 1;}
            @{
                int toPass = 0;
                if (ViewBag.pageNum != null)
                {
                    toPass = ViewBag.pageNum;
                }
         }
         <p id="navListItem0">Invisi</p>
    @foreach (var item in ViewBag.ESList)
    {
        { count = count + 1; }
        if (count == 11)
        {
            break;
        }
        <div id="navListItem">
        @{string temp = "";}
        @{temp = "[" + (count - 1) + "]:" + item.DateCreated.ToString("dd") + "/" + item.DateCreated.ToString("MM") + "/" + item.DateCreated.ToString("yy") + "-" + item.SessionName;}
        @Html.ActionLink(temp, "listSessions", new { SessionID = item.ExerciseSessionId }, new { id = "aCustom", onMouseOver = "this.style.color='#FFFFFF'", onMouseOut = "this.style.color='#808080'" }) 
        <div id="wbDiv">
        </div>
        </div>
    }
      <div id="navListItem" >
        @Html.ActionLink("Next", "listSessions", new { page = toPass }, new { id = "aCustom" }) 
        | 
        @Html.ActionLink("Back", "listSessions", null, new { id = "aCustom" })
        
      </div>
</div>
</div>
</div>

